package com.qf.ym.web;


import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.qf.ym.service.GoodService;
import com.qf.ym.pojo.GoodsPojo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpServletRequest;
import java.util.List;

@Controller
public class GoodsController {

    @Autowired
    GoodService goodService;

    @RequestMapping("goods-list")
    public String goodsList(HttpServletRequest request){
        PageHelper.startPage(1,3);

        List<GoodsPojo> goodsList = goodService.goodslist(null);

        PageInfo<GoodsPojo> pageInfo = new PageInfo<>(goodsList);

        request.setAttribute("pageInfo",pageInfo);

        return "goodslist";

    }
}
